package com.ruiyian.project.equipment.controller;

import com.ruiyian.common.core.controller.BaseController;
import com.ruiyian.common.core.domain.AjaxResult;
import com.ruiyian.common.core.domain.entity.Point;
import com.ruiyian.common.core.page.TableDataInfo;
import com.ruiyian.project.equipment.domain.FireFillWater;
import com.ruiyian.project.equipment.service.FireFillWaterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author chong
 * @email 673426164@qq.com
 * @create 2022/7/19
 * Desc: 消防补水
 */
@Slf4j
@RestController
@RequestMapping("/equipment/fireFillWater")
public class FireFillWaterController extends BaseController {
    @Autowired
    private FireFillWaterService fireFillWaterService;

    /**
     * 分页列表
     * @param fillWater
     * @return
     */
    @PreAuthorize("@ss.hasPermi('equipment:point:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody FireFillWater fillWater) {
        startPage();
        List<FireFillWater> list = fireFillWaterService.selectListPage(fillWater);
        return getDataTable(list);
    }

    /**
     * 统计
     * @param id
     * @return
     */
    @PostMapping("/selectCountList")
    public AjaxResult selectCountList(@RequestBody Long id) {
        try {
            Map<String, Object> map = fireFillWaterService.selectCountList(id);
            return AjaxResult.success(map);
        } catch (Exception e) {
            logger.error(e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

}
